import React from 'react';
import base64url from "base64url";
import { connect } from 'dva'
import { routerRedux } from 'dva/router';
import { Icon, List, WhiteSpace, Tabs, TextareaItem ,ImagePicker,Button} from 'antd-mobile';
import { createForm } from 'rc-form';
import styles from './supportparticulars.less'
import banner from '../../../../assets/work/dsb.jpg';

const Item = List.Item;
const Brief = Item.Brief;
class supportparticulars extends React.Component{
  constructor(props){
    super(props);
    this.state={
      files: [],//上传的图片
    }
  }

  onDelete=()=>{
    if(this.props.particulars) {
      this.props.dispatch(
        {
          type: 'particulars/particulardelete',
          payload: {id: this.props.particulars.id1}
        }
      )
    }

  }

  render(){
    const { getFieldProps } = this.props.form;
    const { files } = this.state;
    const { org,type1,name1,id1 } = this.props.particulars
    // const name=data.ret.object;//名字
   const type ='';//党员类型为空，头像也没有

    return(
<form>
      <div>
        <List className="superiorp_list">
          <Item
            thumb={banner}
            multipleLine
            onClick={() => {}}
          >
            {name1} <Brief>正式党员</Brief>
          </Item>
        </List>
        <List>
          <Item  wrap={true} extra={org}>
            所属组织
          </Item>
        </List>
        <WhiteSpace/>
        <List>
          <Item  multipleLine extra={type1}>
            困难类型
          </Item>
        </List>
        <WhiteSpace/>
        <List>
          <TextareaItem
            {...getFieldProps('note1')}
            rows={3}
            placeholder="这里是困难的原因描述"
          />
        </List>
        <WhiteSpace/>
        <div className={styles.imgeUploader}>
          <ImagePicker
            files={files}
            onChange={this.onChange}
            onImageClick={(index, fs) => console.log(index, fs)}
            selectable={files.length < 9}
          />
        </div>
        <WhiteSpace/>
        <WhiteSpace/>
        <WhiteSpace/>
        <Button style={{width:'80%',marginLeft:'10%',backgroundColor:'#ff2c2c',color:'#ffffff'}} onClick={this.onDelete}>取消</Button>
      </div>
</form>
    )
  }
}

function mapStateToProps({ particulars }){
  return {
    particulars
  };
}

const supportparticularsx = createForm()(supportparticulars);

export default connect(mapStateToProps)(supportparticularsx);
